﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.Objects;


namespace WebService
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class Service : System.Web.Services.WebService
    {

        [WebMethod]
        public bool DangNhap(string username, string password)
        {
            KhachSanEntities ks = new KhachSanEntities();
            var count = ks.proc_DangNhap(username, password).FirstOrDefault();
            if (count == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /* [WebMethod]
         public List<HangPhong> LayDSHangPhong()
         {
             return List<HangPhong>;
         }

         [WebMethod]
         public List<LoaiPhong> LayDSLoaiPhong()
         {
             return List<LoaiPhong>;
         } */

        [WebMethod]
        public int LaySoLuongPhongTrong(string MaLoaiPhong, string MaHangPhong, DateTime NgayBD, DateTime NgayKT)
        {
            KhachSanEntities ks = new KhachSanEntities();
            return 0;
        }

        [WebMethod]
        public int LayGiaThanh(String MaLoaiPhong, String MaHangPhong)
        {
            KhachSanEntities ks = new KhachSanEntities();
            int? giaThanh = ks.proc_GiaPhong(MaLoaiPhong, MaHangPhong).FirstOrDefault();
            return giaThanh.Value;
        }

        [WebMethod]
        public bool DatPhong(String MaLoaiPhong, String MaHangPhong, DateTime NgayBD, DateTime NgayKT, int SoLuong)
        {
            return true;
        }

    }
}